package gopkgdemo

import "strings"
import (
	"fmt"
	"math/rand"
	"strconv"
	"time"
)

func ToUpper(str string) string{
	return strings.ToUpper(str)
}

func CaiShu() {
	var guess string
	rand.Seed(time.Now().Unix())
	answer := rand.Intn(1000)
	for {
		fmt.Print("请输入您的猜想：")
		fmt.Scanf("%s", &guess)
		if guess == "exit" {
			fmt.Printf("正确数值为：%d\n", answer)
			break;
		}
		ret, _ := strconv.Atoi(guess)
		if ret > answer {
			fmt.Println("猜大了啊")
		} else if ret < answer {
			fmt.Println("猜小了啊")
		} else {
			fmt.Println("恭喜，您猜中了！")
			break;
		}
	}
}
